
{% if not crate %}
{% set crate = "std" %}
{% endif %}

{% if mod %}
{% set mod_path = "/" ~ mod | replace(from="::", to="/") %}
{% else %}
{% set mod_path = "" %}
{% endif %}

{% if crate == "std" %}
{% set url = "https://doc.rust-lang.org" %}
{% set path = "stable/" ~ crate %}
{% else %}
{% set url = "https://docs.rs" %}
{% set path = crate ~ "/latest/" ~ crate %}
{% endif %}

<a href="{{url}}/{{path}}{{mod_path}}/index.html"><code>{% if not no_crate and crate%}{{crate}}{% if not no_mod and mod%}::{{mod}}{% endif %}{% elif not no_mod and mod%}{{mod}}{% endif %}</code></a>